<?php
class Admin_IndexController extends Zend_Controller_Action
{   
    /**
     * This action is the home page of the website
     *
     */
    public function indexAction()
    {
        $this->view->title = 'Welcome to Wmp titre!';
        $this->view->headTitle('Welcome');
	
        $this->view->content="hello";
    }
    
    private function deleteRecursve($dir)
    {
    	if ($handle = opendir($dir)) 
    	{   			
    		while (false !== ($file = readdir($handle))) 
   			{
   				if($file !='.' && $file !='..') {
	   				echo "essaie pour : ". $file.'<br />';
	        		if ($file == ".svn" ) 
	        		{
	        			try {
	        				while ($svnfile = readdir($file)) {
	   							unlink($file."/".$svnfile);
	   							//$files++;
	  						}
	        				
	        				rmdir($file);        				
	            			echo $i.'<br />';
	            			$this->i++;	
	        			}
	        			catch (Exception $e) {
	        				echo "erreur<br />";
	        				//echo $e->toString();
	        			}            		  
	        		}
	        		else {
	        			$this->deleteRecursve($file);
	        		}
	    		}
	    		closedir($handle);
   			}
		}	
    }
    
    public function deleteSvnAction()
    {
        $config = Zend_Registry::get('config');     
    	$this->deleteRecursve($config->path->root->app);
		exit;       
    } 
}